<?php
session_cache_expire(999999999);
if(!isset($_SESSION)) 
{ 
session_start(); 
} 
if(!isset($_SESSION['db'])){
	$addressbrowser = $_SERVER['SERVER_NAME'];
	$temp = explode(".", $addressbrowser);
	$connection = mysql_connect("1.234.53.52", "cam", "5678" ) ;
	//$connection = mysql_connect("localhost", "root", "root" ) ;
	mysql_select_db("elihan", $connection);
	mysql_query("set names 'utf8'");
	$selectdatabase = mysql_query("SELECT am.DatabaseName,am.Logo from ac_eli_manager am where am.KeyName='$temp[0]' and am.`Status` = 2");
	$result = mysql_fetch_assoc($selectdatabase);

	$_SESSION['Logo']=$result[Logo];
		
	$_SESSION['db']= $result[DatabaseName];
	mysql_close($connection);
}
$database = $_SESSION['db'];
$connectadmin = mysql_connect("1.234.53.52", "cam", "5678") or die("Không kết nối được database");
//$connectadmin = mysql_connect("localhost", "root", "root") or die("Không kết nối được database");
		mysql_select_db("elihan", $connectadmin);
		mysql_query("set names 'utf8'");
		
$selectprofilecomp = mysql_query("SELECT eli.PartnerName, eli.Address,eli.BusinessNumber, eli.CorporateNumber
		 FROM ac_eli_manager eli where eli.DatabaseName='$database'");

$row = mysql_fetch_assoc($selectprofilecomp);
mysql_close($connectadmin);
?>
<?php 

include '../../operations/connection.php';
$newlang = $_REQUEST['newlang'];

if ($_REQUEST['newlang'] == "EN") {
	include "../../value/value_en.php";
} else if($_REQUEST['newlang'] == "VN") {
	include "../../value/value_vn.php";
}
else {
	include "../../value/value_kr.php";
}

$idemppower = $_REQUEST['idemppower'];
$idempassign = $_REQUEST['idempassign'];

$selectpower = mysql_query("SELECT e.FullName, e.CMND FROM employee e where  e.IDEmployee = '$idemppower'");
$selectassign = mysql_query("SELECT e.FullName, e.CMND,e.Address,e.Position FROM employee e where  e.IDEmployee = '$idempassign'");

$resultpower = mysql_fetch_assoc($selectpower);
$resulrassign = mysql_fetch_assoc($selectassign);

?>
<div style="margin-left: 5px;">
	<div style="height: 10px;"></div>
	<div class="navigation-button" style="background-color: #eef1f3;">
		<a href="#" onclick="onclickback(this)"><img src="images/back-admin.png" /> </a>
		<div><?php echo $l_back?></div>
	</div>
	<div class="navigation-button" style="background-color: #eef1f3;">
			<a href="admin/employeemanagement/print-power-attorney.php?idemppowers=<?=$idemppower?>&idempassigns=<?=$idempassign?>" target="_blank">
				<input type="submit" name="print" id="print" value="" 
				style="background: url('images/print-admin.png') no-repeat 40px center;
				 width: 100px; height: 30px;border-bottom: none;border-right: none;cursor: pointer;"></a>
				  <div><?php echo $l_print?></div>
		</div>
	 
	
	<br style="clear:both" /><br />
	<div class="print-credential">
		<span class="print-credential-caption"><?php echo $l_powerattorny?></span> 
		<span><b><?php echo $l_company_name?></b> : <?php echo $row[PartnerName];?></span><br /> 
		<span><b><?php echo $l_address?></b> : <?php echo $row[Address];?></span><br />
		<span><b><?php echo $l_corponum?></b> :<?php echo $row[CorporateNumber];?></span><br /> 
		<span><b><?php echo $l_bussinum?></b> :<?php echo $row[BusinessNumber];?></span><br /> 
		<span><b><?php echo $l_itemattorny?></b> : </span><br />
		<span><b>1. <?php echo $l_principals?> : </b> <?php echo $resultpower[FullName]."( ".$l_cmnd." : ".$resultpower[CMND].")";?></span><br />
		<div style="margin: 200px 0px 0px 0px;">
			<b>2. <?php echo $l_assignee?> </b>
		</div>
		<span><b><?php echo $l_fullname?></b> : <?php echo $resulrassign[FullName];?></span><br /> 
		<span><b><?php echo $l_cmnd?></b> : <?php echo $resulrassign[CMND]?></span><br />
		<span><b><?php echo $l_address?></b> : <?php echo $resulrassign[Address]?></span><br /> 
		<span><b><?php echo $l_relationship?></b> : <?php echo $l_employee?></span><br />
		<div style="margin: 100px 0px 200px 0px;">
			<b>3. <?php echo $l_madateditem?></b>
		</div>
		<div id="date" style="text-align: right">
		<?php if ($newlang=="EN"){$datetime = date('Y-m-d') ;echo $datetime;}
					else if($newlang=="VN"){$day = date('d');$month = date('m');$year=date('Y');
						echo "Ngày ".$day." Tháng ".$month." Năm ".$year;}
					else if($newlang=="KR"){$day = date('d');$month = date('m');$year=date('Y'); 
						echo $year." 년  ".$month." 월  ".$day." 일";}
				?>
		</div>
	</div>
</div>
<?php mysql_close($connection);?>